package org.muses.ssm.senior.mgt.demo.service;

import org.muses.ssm.senior.mgt.demo.entity.Employee;
import org.muses.ssm.senior.mgt.demo.entity.MusesResult;
import org.muses.ssm.senior.mgt.demo.mapper.EmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageInfo;

@Service("employeeService")
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public Employee getEmpById(Integer id) {
        return employeeMapper.getEmpById(id);
    }

    @Override
    public PageInfo<Employee> list(Employee employee) {
        return employeeMapper.list(employee);
    }

    @Override
    public MusesResult update(Employee employee) {
        employeeMapper.update(employee);
        return MusesResult.success("S.EMPLOYEE.UPDATE.SUCCESS", "");

    }

    public MusesResult add(Employee employee) {
        employeeMapper.insert(employee);
        return MusesResult.success("S.EMPLOYEE.ADD.SUCCESS", "");
    }

}